<template>
  <div>
    <div
      @click="gofind(item.id)"
      class="finditem"
      v-for="(item, index) in list"
      :key="index"
    >
      <div class="left">
        <p>{{ item.title }}</p>
        <div class="info">
          <span class="span1">{{ item.created_at | formatData }}</span>
          <span class="iconfont iconicon_liulanliang">{{ item.read }}</span>
          <span class="iconfont iconbtn_dianzan_small_nor"></span>
        </div>
      </div>
      <div class="right" v-if="item.cover">
        <img class="img" :src="item.cover | formatImg" alt="" />
      </div>
    </div>
  </div>
</template>

<script>
import { articlesTechnic } from '@/api/find.js'

export default {
  name: 'Finditem',
  props: {
    forms: {
      type: Object,
      default: () => ({})
    }
  },
  model: {
    prop: 'forms'
  },
  data () {
    return {
      list: []
    }
  },
  created () {
    this.getData()
  },
  methods: {
    async getData () {
      const res = await articlesTechnic(this.forms)
      // console.log('list:', res)
      this.list = res.data.list
      // console.log(this.list)
      this.$toast.loading({ message: '加载中' })
      this.$nextTick(() => {
        this.$toast.clear()
      })
    },
    gofind (id) {
      this.$router.push('./finddetail?id=' + id)
    }
  }
}
</script>

<style scoped lang="less">
.finditem {
  display: flex;
  background-color: #fff;
  .left {
    flex: 2;
    height: 180px;
    .info {
      color: #a5a6ab;
      font-size: 12px;
      display: flex;
      margin-top: 45px;
      .span1 {
        flex: 4;
      }
      span {
        flex: 2;
      }
      .iconfont {
        font-size: 10px;
      }
    }
  }
  .right {
    width: 226px;
    height: 150px;
    flex: 1;
    .img {
      height: 90%;
      width: 100%;
    }
  }
}
</style>
